#ifndef FILTERCONFIG_H
#define FILTERCONFIG_H

#include <math.h>
#include <array>
#include <assert.h>

#include "dmdef.h"

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

namespace FilterConfig
{

/*!
 * @brief FS 采样频率
 */
constexpr int FS_48K = 48000;
constexpr int FS_96K = 96000;
constexpr int FS = FS_96K;

constexpr double TWO_PI = 2 * M_PI;             // 2π常量
// 角频率计算: w0 = 2 * PI * Fc / Fs；   Fc：截止频率
constexpr double FS_PI = TWO_PI / FS;


}
constexpr int COEFFS_SIZE = 4;
// 滤波器系数结构体
struct BiquadCoeffs
{
    std::array<double, COEFFS_SIZE> a0; // 4个二阶节的a0系数（最多4个二阶节，对应48dB斜率）
    std::array<double, COEFFS_SIZE> a1;
    std::array<double, COEFFS_SIZE> a2;
    std::array<double, COEFFS_SIZE> b0;
    std::array<double, COEFFS_SIZE> b1;
    std::array<double, COEFFS_SIZE> b2;

    // 构造函数：默认初始化所有系数为0，避免未初始化
    BiquadCoeffs() : a0{0}, a1{0}, a2{0}, b0{0}, b1{0}, b2{0} {}
};

// first is freq, second is gain
using FreqGainArray = std::array<std::pair<double, double>, EQ_FREQUENCY_COUNT>;

#endif // FILTERCONFIG_H
